#ifndef INCLUDED_CHARACTER_H
#define INCLUDED_CHARACTER_H

#include <SGE.h>
using namespace SGE;

#include "Projectile.h"
#include "Melee.h"
#include "Shield.h"
#include "Health.h"

//forward declaration, preffered for header files
class Map;
class EnemyPool;

enum lastMovement
{
	Left,
	Right
};

class Character
{
	public:
		Character();
		~Character();

		void Load();
		void Unload();
		void Update(float deltaTime, Map& map, EnemyPool& ePool);
		void Render(const SVector2& viewOffset);

		SRect GetBoundingBox() const;

		void SetPosition(const SVector2& pos) {mPosition = pos;}
		const SVector2& GetPosition() const { return mPosition; }

		SCircle GetBoundingCircle() const	{ return SCircle(mPosition, 40.0f); }
		bool IsShielded()	{ return mShielded; }

		Health mCurrentHealth;
		bool GameOverStateSwitch()	{ return mLives <= 0; }
		bool CharacterAlive()	{ return mCurrentHealth.IsAlive(); }

	private:
		void HorizontalMovement(float deltaTime, const Map& map);
		void VerticalMovement(float deltaTime, const Map& map);
		void FireProjectile();
		void MeleeAttack();
		void ShieldUp();

		SGE_Sprite mSprite;
		SVector2 mPosition;
		Projectile mProjectiles[100]; //***
		const int kMaxProjectiles;
		int mProjectileIndex;
		int mLastHorizontalMovement;

		Melee mMeleeAttack;
		Shield mShield;
		bool mShielded;
		
		void DealProjectileDamage(EnemyPool& ePool);
		void DealMeleeDamage(EnemyPool& ePool);

		int mLives;
		SGE_Sprite mLifeSprite;
		SGE_Font mFont;

		SGE_Sound mMeleeSound;
		SGE_Sound mProjectileSound;
		SGE_Sound mShieldSound;
		SGE_Sound mDeathSound;
		SGE_Sound mTacoDamage;
};
#endif // #ifndef INCLUDED_FIGHTER_H